package com.designpatterns.GuardedSuspention;

import java.util.concurrent.TimeUnit;

/**
 * Created by 41579 on 2017/6/1.
 */
public class ClientThread implements Runnable {
    private RequestQueue requestQueue;

    public ClientThread(RequestQueue requestQueue) {
        this.requestQueue = requestQueue;
    }

    @Override
    public void run() {
        while(true) {
            try {
                TimeUnit.SECONDS.sleep(3);
            } catch (InterruptedException e) {
                e.printStackTrace();
            }
            System.out.println(requestQueue.get().getName());
        }
    }
}
